import axios from 'axios'
axios.defaults.baseURL="http://localhost:7003";
// axios.defaults.baseURL="http://39.106.114.220:7002";
import store from '../store'
axios.defaults.timeout=50000;
//登录
export const login = (params)=>{
  return axios({
    method:'post',
    url:'/user/login',
    data:params
  })
}
export  const homeAll = ()=>{
  return axios({
    method:'get',
    url:'/blog/homeAll'
  })
}
export  const pageSelect = (params) =>{
  return axios({
    method:'get',
    url:'/blog/pages?current='+params,
  })
}
export const selectAll = (params) =>{
  return axios({
    method:'get',
    url:"/comment/selectAll/"+params
  })
};
export const publish = (url,params) =>{
  const token = localStorage.getItem("token");
  return axios({
    method:'post',
    data:params,
    url:`${url}`,
    headers: {
      'Authorization':token
    }
  })
}
export const likesAll = (url) =>{
  return axios({
    method:'get',
    url:`${url}`,
  })
};
//uploadFileRequest请求
export const uploadFileRequest = (url, params) => {
  return axios({
    method: 'post',
    url: `${url}`,
    data: params,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};
/*保存到数据*/
export const preserve = (url,params) =>{
  return axios({
    method: 'post',
    url: `${url}`,
    data: params,
  })
};
/*主页数据*/
export const homeDatas = (url) =>{
  return axios({
    method:'get',
    url: `${url}`,
  })
};
export const findById = (url) =>{
  return axios({
    method:'get',
    url:`${url}`
  })
};
export const fileList = (url) =>{
  return axios({
    method:'get',
    url:`${url}`
  })
};
export const seekAll = (url) =>{
  return axios({
    method:'get',
    url:`${url}`,
  })
};
export const essence = (url) =>{
  return axios({
    method:'get',
    url:`${url}`,
  })
};
export const dataSource = (url) =>{
  return axios({
    method:'get',
    url:`${url}`,
  })
}



